import java.util.Scanner;

public class Main1774 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] num=new int[n];
        for (int i=0;i<num.length;i++){
            num[i]=sc.nextInt();
        }
        int a=0;
        int b=0;
        for (int i=0;i< num.length;i++){

            if (num[i]%2==0){
                a=a+num[i];
            } else if (num[i]%2==1){
                b=b+num[i];
            }
        }
        System.out.println(b);
        System.out.println(a);
    }
}
